﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using System.Diagnostics;

namespace DARE
{
    public class CAnimSplitter
    {
        #region Fields

        [ContentSerializer]
        private Dictionary<string, KeyValuePair<int, int>> m_anims;

        [ContentSerializer]
        private string m_animationName;

        #endregion

        #region Property
        #endregion

        #region CTOR

        public CAnimSplitter() {}

        public CAnimSplitter(IAnimation anim)
        {
            m_anims = new Dictionary<string, KeyValuePair<int, int>>();
            m_animationName = anim.Name;
        }

        #endregion

        #region Method

        public void AddAnimation(int idStart, int idend, string name)
        {
            Debug.Assert(!m_anims.ContainsKey(name));
            m_anims.Add(name, new KeyValuePair<int, int>(idStart, idend));
        }

        public void Run(IAnimation anim)
        {
            foreach (var el in m_anims)
                anim.CutAnimation(el.Value.Key, el.Value.Value, el.Key);
        }

        #endregion

    }
}
